package com.github.baichuan.application.scaffold.dto.resource;

import com.github.baichuan.mapping.Mapping;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Getter;

@Schema(title = "操作功能")
@Getter
public class ActionForm {
    @Schema(title = "操作功能名称", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "操作功能名称不能为空")
    @Size(max = 16, message = "操作功能名称最多16个字符")
    @Mapping
    private String name;

    @Schema(title = "资源代码")
    @NotBlank(message = "资源代码不能为空")
    @Size(max = 32, message = "资源代码最多32个字符")
    @Mapping
    private String code;

    @Schema(title = "父资源")
    @Mapping("parent.id")
    private String parentId;

    @Schema(title = "排序", requiredMode = Schema.RequiredMode.REQUIRED)
    @Mapping
    @NotNull(message = "排序不能为空")
    private Integer sort;
}
